$(function(){
	
	//锚点点击跳转到对应的
	$(".page_but a").click(function(){		
		var _index=$(".page_but a").index(this);
		//alert(_index);
		//$("html,body").animate({scrollTop:300px},1000);
		y=$(".certification-item .certification-list").eq(_index).offset().top;
		$("html,body").animate({scrollTop:y},1000);
	})
     
     
	//点击显示相应的当前状态
	$(".certification-option").on('click',function(){
		//alert("1212");
		var _index=$(".certification-option").index(this);
		//alert(_index);
		$(".page_but a").eq(_index).addClass("active");
		//$(".page_but a").addClass("active");
	})
	
	//点击题显示当前状态
	$(".certification-option .option").on('click',function(){
		$(this).addClass("active").siblings().removeClass("active");
		
	})

	 //弹出付费窗口	  
	  $('.cerBtn').on('click', function(event){
	    	 $('.warning').addClass('is-visible');	  
	  });	  
	  //关闭弹出窗口 
	  $('.submitPaper-icon').on('click', function(event){ 
	      $('.warning').removeClass('is-visible');
	      //window.location="courseKeep.html";
	  }); 
	  $('.submitPaper-cancel').on('click', function(event){ 
	      $('.warning').removeClass('is-visible');
	      //window.location="courseKeep.html";
	  });
	  $('.submitPaper-determine').on('click', function(event){ 
	  	  $('.submitPaper-popup').addClass('is-visible');
	      $('.warning').removeClass('is-visible');
	      //window.location="courseKeep.html";
	  });
	  $('.submitPaper-popup .submitPaper-icon').on('click', function(event){ 
	      $('.submitPaper-popup').removeClass('is-visible');
	      //window.location="courseKeep.html";
	  });
	  //使用Esc键关闭弹出窗口 
	  $(document).keyup(function(event){ 
	    if(event.which=='27'){ 
	      $('.popup').removeClass('is-visible'); 
	    } 
	  });
	  
	  $(".paper-btn span").on('click',function(){
	  	window.location.href="examinationPaper.html";
	  })
	
	//进去页面开始倒计时
	var m = 1; //定义分
	var s = 3; //定义秒
	function showtime(){
	document.getElementById('m').innerHTML = m;
	document.getElementById('s').innerHTML = s;	
		s--;
		if(s===0){
			s=0;
			//alert("2121");
			if(m===0){
				//console.log("考试时间到,请提交考卷");
				alert("考试时间到");
				clearInterval(settime);
			}else{
				m--;
				s=60;
			}
		}
	}

	var settime = setInterval(function(){
		showtime();
	},1000);
			
			
			
			
})
